package cn.edu.scau.cmi.liangzijian.decorator;

public class PersonList implements MyList {
	MyList myList = null;
	
	public PersonList(MyList _myList) {
		myList = _myList;
	}
	
	@Override
	public boolean add(Object o) {
		Person p = (Person)o;
		
		if(p.getName() == null)
			return false;
		if(p.getAge() <= 0)
			return false;
		if(p.getIdCard() == null)
			return false;
		
		return myList.add(o);
	}

	@Override
	public Object remove(int index) {
		return myList.remove(index);
	}

	@Override
	public void list() {
		myList.list();
	}
}
